package builder;

import java.util.List;

/**
 * @author gaopeng
 * @date 2019/12/8 1:48 下午
 */
public abstract class AbstractCarModel {
    private List<String> sequent;

    protected abstract void start();

    protected abstract void stop();

    protected abstract void alarm();

    protected abstract void engineBoom();

    final public void run(){
        for (String s : sequent) {
            if("start".equals(s)){
                start();
            }else if("stop".equals(s)){
                stop();
            }else if("alarm".equals(s)){
                alarm();
            }else if("engineBoom".equals(s)){
                engineBoom();
            }
        }
    }

    protected void setSequent(List<String> sequent){
        this.sequent = sequent;
    }
}
